// https : // iai.sh.cn/problem/899
#include <bits/stdc++.h>
using namespace std;
long long a[300005];
long long c[300005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> c[i];
  }
  long long out = 0;  // 总的花钱数量
  long long in = 0;   // 总的赚钱数量
  long long high = 0; // 前i天每天最多赚多少钱
  long long ans = 0;
  
  for (int i = 1; i <= n; i++) {
    out += c[i];
    high = max(high, a[i]);
    // 打工时间（向上取整）
    long long t = (out - in + high - 1) / high;
    in += t * high;
    ans += t;
  }
  cout << ans;
  return 0;
}